// @ts-ignore
import { request } from "./request";
interface FormData {
    name: string;

}
interface ListDefParams {
    pageSize?: number;
    pageNum?: number
}
interface ListRowRes<T> {
    pageNum: number;
    pages: number;
    total: number;
    rows: T[]
}
export interface ProListRes {
    id: string,
    name: string
}
export interface WarehouseListRes {
    address: string;
    id: string;
    name: string;
    state: number;
    storageStorage: string;
    storageWay: string;
}
export interface ProcessListRes {
    "id": string,
    "executiveStandard": string,
    "craftName": string,
    "varietyName": string,
    "materialCode": string,
    "processStep": string,
    "state": number,
    "createTime": string
}
export interface ProcessDetailRes {
    "id": string,
    "executiveStandard": string,
    "craftName": string,
    "varietyName": string,
    "materialCode": string,
    "processStep": { processName: string; processPicture: string }[],
    "state": number,
    "createTime": string
}
export interface MaterialListRes {
    id: string;
    varietyName: string;
    materialCode: string;
    varietyAddTime: string;
    loadingQuantity: string;
    unit: string;
    specification: string;
    inventoryCode: string;
    expirationDate: string;
    productBigKind: string;
    colorChart: string;
    state: number;
    placeOfOriginJSON: string[]
    materialRelevanceId: string;
    placeOfOrigin: string[];
    basinymLatin: string;
    basinymName:string
    dispensingMachineCoder:string
    medicinalCategory:string
    source:string
    medicineValue:string
    medicineClass:string
}
export interface SupplierListRes {
    id: string;
    name: string;
    state: number
}
export interface SupplierDetailRes {
    id: string;
    name: string;
    state: number;
    code: string;
    recordVariety: { varietyName: string; materialCode: string }[]
    supplierInfo: { varietyName: string; materialCode: string }[]
}
export interface AccountListRes {
    userId: string;
    name: string;
    phone: string;
    organizationName: string
}
export interface ClientListRes {
    id: string;
    name: string;
    phone: string;
    contacts: string;
    detailAddress: string
}
export interface PermissionsRes {
    id: string;
    name: string;
    parentId: string;
    title: string;
    type: 'XT' | 'GZT';
    children?: PermissionsRes[]
}
export interface LicenceRes {
    id: string;
    productionCertificate: string
}
export interface OrganizationListRes {
    id: string;
    name: string;
    parentId: string;
    children: OrganizationListRes[]
}
export interface DetectionListRes {
    "executeStandard": string,
    "createTime": string,
    "checkoutStandardFile": string,
    "id": string,
    "varietyName": string,
    "state": number
}
export interface TestingListRes {
    "id": string,
    "name": string,
    "principalId": string,
    "principal": string,
    "state": number,
    "createTime": string
}
export interface CheckoutListRes {
    "unit": string,
    "enterStorageTime": string,
    "num": string,
    "batch": string,
    "id": string,
    "varietyName": string,
    "enterStorageType": string,
    "detectionState": number,
    "detectionBatch": string,
    "reportTime": string
    "detectionReport": string
}
export interface PackagingListRes {
    "productBigKind": string
    "discretion": number
    "unit": string
    "putIntoNum": number
    "placeOfOrigin": string
    "practicalYield": number
    "secondBatch": string
    "id": string
    "varietyName": string
    "productBatch": string
    "productionTime": string
    "advocateBatch": string
    "expirationDate": number
    "subpackageState": number

}
export interface AuditSubListRes {
    id: string
    subpackageState: number
}
export interface ProductionUsePackRes {
    "unit": string,
    "feedName": string,
    "putIntoNum": number,
    "placeOfOrigin": string,
    "productionBatch": string,
    "id": string,
    "productionTime": string,
    "massStandard": string,
    medicineValue:string
    medicineClass:string
}
export interface PrintInfoListRes {
    id: string
    printState: number
    printNum: number
}
export interface PrintSendDetialRes {
    placeOfOrigin: string
    discretion: string
    productBatch: string
    productionTime: string
    expirationDate: string
    specification: string
    stockpileCondition: string
    executiveStandard: string
    varietyName: string
    tidyQrCode: string
    inDetailQrCode: string
}
export interface ProductionListRes {
    id: string
    surplus: string
    unit: string
    practicalYield: string
    packState: number
    materialsList: any[]
}
export interface AddMaterListRes {
    "unit": string,
    "rawType": string,
    "enterStorageNum": number,
    "enterStorageBatch": string,
    "id": string,
    "varietyName": string,
    "massStandard": string,
    placeOfOrigin: string
}
export interface ProductInListRes {
    id: string;
    practicalYield: string;
    unit: string
}
export interface EnterLibraryListRes {
    id: string;
}
const nextApi = {
    other: (params: any, callback: any) => {
        return request<{ list: [] }>({
            params,
            url: '/assetManage/findByList',
            method: 'get',
            headers: { 'Content-Type': 'multipart/form-data' },
            responseType: 'arraybuffer'
        }, callback)
    },
    checkCode: () => {
        return request<{ captcha: string }>({
            url: '/captchaImage',
            method: 'get',
        })
    },
    userLogin: (data: { pwd: string; name: string; code: string }) => {
        return request({
            data,
            url: '/ypAccount/pcLogin',
            method: 'post',
        })
    },

    // ------------------------ 生产管理 ----------------
    getProList: (params: { varietyName?: string|undefined,productType?:string } & ListDefParams) => {
        return request<{ data: ListRowRes<ProductionListRes> }>({
            params,
            url: '/ypProductionManagement/findProduction',
            method: 'get',
        })
    },
    getAvailableMaterList: (params: {id:string}) => {
        return request({
            params,
            url: '/ypInventory/findRealTimeNumById',
            method: 'get',
        })
    },
    getProDetial: (params: { id: string }) => {
        return request<{ data: ProductionListRes }>({
            params,
            url: '/ypProductionManagement/findProduction',
            method: 'get',
        })
    },
    getAddMaterList: (varietyInitial: string) => {
        return request<{ data: AddMaterListRes[] }>({
            params: { varietyInitial },
            url: '/ypInventory/findRawMaterialInfo',
            method: 'get',
        })
    },
    addPro: (data: any) => {
        return request({
            data,
            url: '/ypProductionManagement/addProduction',
            method: 'post',
        })
    },
    deletePro: (id: string) => {
        return request({
            url: `/ypProductionManagement/removeProduction/${id}`,
            method: 'delete',
        })
    },
    addYield(data:{id:string,residueNum:any}){
        return request({
            data,
            url: '/ypProductionManagement/addYield',
            method: 'post',
        })
    },
    // ------------------------ 仓库管理 ----------------
    getWarehouseList: (params: { name?: string; state?: number }) => {
        return request<{ data: WarehouseListRes[] }>({
            params,
            url: '/ypWarehouse/findWarehouse',
            method: 'get',
        })
    },
    setWarehouseState: (data: WarehouseListRes) => {
        return request({
            data,
            url: '/ypWarehouse/addWarehouse',
            method: 'post',
        })
    },

    // ------------------------ 销售管理 ----------------
    // 下载销售数据导入模板
    downloadSellImportTemplate: (callback: any) => {
        return request({
            url: '/ypSell/downloadImportTemplate',
            method: 'get',
            responseType: 'blob',
        },callback)
    },
    // 导入销售数据
    importSellData: (formData: globalThis.FormData) => {
        return request({
            data: formData,
            url: '/ypSell/importSellData',
            method: 'post',
            headers: { 'Content-Type': 'multipart/form-data' },
        })
    },
    getDiscretionByBatch:(params:{productBatch:string})=>{
        return request({
            url:'/ypPackagingManagement/findDiscretionfoByBatch',
            method:'get',
            params
        })
    },
    getTableListOrDetail:(params:{id?:string} & ListDefParams)=>{
        return request({
            params,
            url: '/ypSell/findSell',
            method: 'get',
        })
    },
    getVarietyListByProductType:(params:{productType:string,varietyName?:string})=>{
        return request({
            params,
            url:'/ypPackagingManagement/findVarietyInfoByProductType',
            method:'get',
        })
    },
    getBatchByMaterialCode(params:{materialCode:string}){
        return request({
            params,
            url:'/ypPackagingManagement/findBatchByMaterialCode',
            method:'get',
        })
    },
    //T:productType M:materialCode B:productBatch
    getInfoByTMB(params:{productType?:string,materialCode?:string,productBatch?:string}){
        return request({
            params,
            url:'/ypPackagingManagement/findProductBigKindAndDiscretion',
            method:'get',
        })
    },
    addSaleRecord: (data: any) => {
        return request({
            data,
            url: '/ypSell/addSell',
            method: 'post',
        })
    },
    removeRecord: (id: number) => {
        return request({
            url: `/ypSell/removeSellById/${id}`,
            method: 'delete',
        })
    },
    // ------------------------ 追溯查询 ----------------
    selectBigKind:()=>{
        return request({
            url: '/ypPackagingManagement/findProductBigKind',
            method: 'get',
        })
    },
    selectDiscretion:(params:{productBigKind:any})=>{
        return request({
            params,
            url: '/ypPackagingManagement/findSpecificationByProductBigKind',
            method: 'get',
        })
    },
    selectBatch:(params:{productBigKind:any,discretion:any})=>{
        return request({
            params,
            url: '/ypPackagingManagement/findBatchBySpecificationAndProductBigKind',
            method: 'get',
        })
    },
    selectChainInfo:(params:{batch:any})=>{
        return request({
            params,
            url: '/ypPackagingManagement/findProductRetrospectInfo',
            method: 'get',
        })
    },
    // ------------------------ 单位管理 ----------------
    getUnitList: () => {
        return request<{ data: { id: string; unit: string }[] }>({
            url: '/ypUnit/findUnitS',
            method: 'get',
        })
    },
    addUnit: (data: string[]) => {
        return request({
            data,
            url: '/ypUnit/findUnit',
            method: 'post',
        })
    },
    deleteUnit: (params: { id: string }) => {
        return request({
            url: `/ypUnit/removeUnit/${params.id}`,
            method: 'delete',
        })
    },
    // ------------------------ 工艺工序 ----------------
    getProcessList: (params: { varietyName?: string; state?: number,productType?:string } & ListDefParams) => {
        return request<{ data: ListRowRes<ProcessListRes> }>({
            params,
            url: '/ypCraftProcess/findCraftProcess',
            method: 'get',
        })
    },
    getProcessDetail: (params: { id: string }) => {
        return request<{ data: ProcessDetailRes }>({
            params,
            url: '/ypCraftProcess/findCraftProcess',
            method: 'get',
        })
    },
    editProcess: (data: any) => {
        return request({
            data,
            url: '/ypCraftProcess/addCraftProcess',
            method: 'post',
        })
    },
    downloadProcessTemplate:(data?:any,callback?:any)=>{
        return request({
            url: `/ypCraftProcess/downloadCraftProcessTemplate?type=${data.type}`,
            method: 'post',
            responseType: 'blob'
        },callback)
    },
    importProcessTemplate: (data: any) => {
        return request({
            data,
            url: `/ypCraftProcess/importCraftProcessTemplate`,
            method: 'post',
        })
    },
    // ------------------------ 企业信息 ----------------
    getEnterpriseInfo: (params: any) => {
        return request({
            url: '/ypCompanyInfo/findCompanyInfo',
            method: 'get',
        })
    },
    editEnterpriseInfo: (data: any) => {
        return request({
            data,
            url: '/ypCompanyInfo/addCompanyInfo',
            method: 'post',
        })
    },

    // ------------------------ 档案管理 ----------------
    // 导出档案数据
    exportMaterialsData: (params: { type: string }, callback: any) => {
        return request({
            params,
            url: '/ypMaterialManagement/exportMaterialsData',
            method: 'get',
            responseType: 'blob',
        }, callback)
    },
    getMaterialList: (params: { productType: string; varietyName?: string; state?: number;medicineClass?:string } & ListDefParams) => {
        return request<{ data: ListRowRes<MaterialListRes> }>({
            params,
            url: '/ypMaterialManagement/findMaterial',
            method: 'get',
        })
    },
    getMaterialNameList: (params: { productType: string;varietyName?: string;}) => {
        return request({
            params,
            url: '/ypMaterialManagement/findOnlyMaterial',
            method: 'get',
        })
    },
    getMaterialDetail: (params: { id: string }) => {
        return request<{ data: MaterialListRes }>({
            params,
            url: '/ypMaterialManagement/findMaterial',
            method: 'get',
        })
    },
    editMaterial: (data: any) => {
        return request({
            data,
            url: '/ypMaterialManagement/addMaterial',
            method: 'post',
        })
    },
    editMaterialState: (data: any) => {
        return request({
            data,
            url: '/ypMaterialManagement/updateState',
            method: 'post',
        })
    },
    uploadMaterial: (data: any) => {
        return request({
            data,
            url: '/ypMaterialManagement/importMaterialTemplate',
            method: 'post',
        })
    },
    downloadMaterialTpl: (data: any, callback: any) => {
        return request({
            data,
            url: `/ypMaterialManagement/downloadMaterialTemplate?type=${data.type}`,
            method: 'post',
            responseType: 'blob'
        }, callback)
    },

    getSubjectList: () => {
        return request({
            url: '/bizSourceinfo/findSubject',
            method: 'get',
        })
    },
    getCategoryList: (subjectId: string) => {
        return request({
            params: { subjectId },
            url: '/bizSourceinfo/findCategory',
            method: 'get',
        })
    },
    getSeedList: (categoryName: string) => {
        return request({
            params: { categoryName },
            url: '/bizSourceinfo/findSeed',
            method: 'get',
        })
    },
    // ------------------------ 供应商管理 ----------------
    getSupplierList: (params: { name?: string; state?: number } & ListDefParams) => {
        return request<{ data: ListRowRes<SupplierListRes> }>({
            params,
            url: '/ypSupplier/findSupplier',
            method: 'get',
        })
    },
    getSupplierDetail: (params: { id: string }) => {
        return request<{ data: SupplierDetailRes }>({
            params,
            url: '/ypSupplier/findSupplier',
            method: 'get',
        })
    },
    editSupplier: (data: any) => {
        return request({
            data,
            url: '/ypSupplier/addSupplier',
            method: 'post',
        })
    },
    // ------------------------ 客户管理 ----------------
    getClientList: (params: { name?: string; } & ListDefParams) => {
        return request<{ data: ListRowRes<ClientListRes> }>({
            params,
            url: '/ypClient/findClient',
            method: 'get',
        })
    },
    editClient: (data: any) => {
        return request({
            data,
            url: '/ypClient/addClient',
            method: 'post',
        })
    },
    deleteClient: (id: string) => {
        return request({
            url: `/ypClient/removeClient/${id}`,
            method: 'delete',
        })
    },
    downloadCustomerTpl: (callback: any) => {
        // return request({
        //     url: `/ypPackagingManagement/exportPrintInfo`,
        //     method: 'get',
        //     responseType: 'blob'
        // }, callback)
    },
    uploadCustomer: (data: any) => {
        // return request({
        //     data,
        //     url: '/ypAccount/importUserTemplate',
        //     method: 'post',
        // })
    },
    // ------------------------ 员工管理 ----------------
    getAccountList: (params: { name?: string; organizationId?: string } & ListDefParams) => {
        return request<{ data: ListRowRes<AccountListRes> }>({
            params,
            url: '/ypAccount/findPcAccountByCondition',
            method: 'get',
        })
    },
    getAccountDetail: (id: string) => {
        return request({
            params: { userId: id },
            url: '/ypAccount/findPcUserByPcUserId',
            method: 'get',
        })
    },
    editAccount: (data: any) => {
        return request({
            data,
            url: '/ypAccount/addPcAccount',
            method: 'post',
        })
    },
    updateAccount: (data: any) => {
        return request({
            data,
            url: '/ypAccount/updatePcAccountDetail',
            method: 'put',
        })
    },
    deleteAccount: (id: string) => {
        return request({
            url: `/ypAccount/removePcUserById/${id}`,
            method: 'delete',
        })
    },
    downloadAccountTpl: (callback: any) => {
        return request({
            url: `/ypAccount/downloadUserTemplate`,
            method: 'post',
            responseType: 'blob'
        }, callback)
    },
    uploadAccount: (data: any) => {
        return request({
            data,
            url: '/ypAccount/importUserTemplate',
            method: 'post',
        })
    },

    // ------------------------ 组织架构 ----------------
    getOrganizationList: (id: string) => {
        return request<{ data: OrganizationListRes[] }>({
            params: { id },
            url: '/ypOrganization/findUserdataByOrganizationId',
            method: 'get',
        })
    },
    editOrganization: (data: any) => {
        return request({
            data,
            url: '/ypOrganization/addOrganization',
            method: 'post',
        })
    },
    deleteOrganization: (id: string) => {
        return request({
            url: `/ypOrganization/removeOrganization/${id}`,
            method: 'delete',
        })
    },
    // ------------------------ 权限 ----------------
    getPermissionsById: (params: { organizationId?: string; userId?: string }) => {
        return request<{ data: PermissionsRes[] }>({
            params,
            url: '/ypResource/findResourceByDepartmentIdAndUserId',
            method: 'get',
        })
    },
    editPermissions: (data: any) => {
        return request({
            data,
            url: '/ypResource/giveDepartmentAndUserAddResource',
            method: 'post',
        })
    },
    // ------------------------ 生产许可证 ----------------
    getLicenceList: () => {
        return request<{ data: LicenceRes }>({
            url: '/ypProductionCertificate/findProductionCertificate',
            method: 'get',
        })
    },
    editLicence: (data: any) => {
        return request({
            data,
            url: '/ypProductionCertificate/updateProductionCertificate',
            method: 'post',
        })
    },
    // ------------------------ 执行标准 ----------------
    getDetectionList: (params: { rawType?: string; varietyName?: string } & ListDefParams) => {
        return request<{ data: ListRowRes<DetectionListRes> }>({
            params,
            url: '/ypDetectionGist/findDetectionGist',
            method: 'get',
        })
    },
    getDetectionDetail: (params: { id: string }) => {
        return request<{ data: DetectionListRes }>({
            params,
            url: '/ypDetectionGist/findDetectionGist',
            method: 'get',
        })
    },
    editDetection: (data: any) => {
        return request({
            data,
            url: '/ypDetectionGist/addDetectionGist',
            method: 'post',
        })
    },
    deleteDetection: (id: string) => {
        return request({
            url: `/ypDetectionGist/removeDetectionGist/${id}`,
            method: 'delete',
        })
    },
    // ------------------------ 检测机构 ----------------
    getTestingList: (params: { name?: string; } & ListDefParams) => {
        return request<{ data: ListRowRes<TestingListRes> }>({
            params,
            url: '/ypDetectionOrganization/findDetectionOrganization',
            method: 'get',
        })
    },
    editTesting: (data: any) => {
        return request({
            data,
            url: '/ypDetectionOrganization/addDetectionOrganization',
            method: 'post',
        })
    },
    // ------------------------ 检验检测 ----------------
    //新执行标准列表
    getDetectionListNew:(params:{rawType?: string; varietyName?: string,productionTime?:string})=>{
        return  request({
            params,
            url: '/ypDetectionGist/findDetectionGistInfo',
            method: 'get',
        })
    },
    getCheckoutList: (params: { varietyName?: string; rawType?: string } & ListDefParams) => {
        return request<{ data: ListRowRes<CheckoutListRes> }>({
            params,
            url: '/ypPackagingManagement/findCheckoutDetection',
            method: 'get',
        })
    },
    getCheckoutDetail: (params: { id: string; rawType: string }) => {
        return request<{ data: CheckoutListRes }>({
            params,
            url: '/ypPackagingManagement/findCheckoutDetection',
            method: 'get',
        })
    },
    editCheckout: (data: any) => {
        return request({
            data,
            url: '/ypPackagingManagement/detectionMedicinalInfo',
            method: 'post',
        })
    },
    removeCheckRercord:(id:string)=>{
        return request({
            url: '/ypDetectionGist/removeDetectionRecord/'+id,
            method: 'delete',
        })
    },
    // ------------------------ 包装管理 ----------------
    removePack:(id:string)=>{
        return request({
            url: '/ypPackagingManagement/removePackaging/'+id,
            method: 'delete',
        })
    },
    getPackSpecificationByKind:(params:{kind?:string,productType:string})=>{
        return request({
            params,
            url: '/ypMaterialManagement/findPackSpecificationByKind',
            method: 'get',
        })
    },
    getBigKindList:(params:{productType:string})=>{
        return request({
            params,
            url: '/ypMaterialManagement/findAllProductBigKind',
            method: 'get',
        })
    },
    getVarietyNameByBigKindAndSpecification:(params:{kind:string,specification:string})=>{
        return request({
            params,
            url: '/ypMaterialManagement/findVarietyNameAndMaterialCode',
            method: 'get',
        })
    },
    gePackagingList: (params: { varietyName?: string,productType?: string } & ListDefParams) => {
        return request<{ data: ListRowRes<PackagingListRes> }>({
            params,
            url: '/ypPackagingManagement/findPackaging',
            method: 'get',
        })
    },
    getPackagingDetail: (params: { id: string; }) => {
        return request<{ data: PackagingListRes }>({
            params,
            url: '/ypPackagingManagement/findPackaging',
            method: 'get',
        })
    },
    editPackaging: (data: any) => {
        return request({
            data,
            url: '/ypPackagingManagement/addPackaging',
            method: 'post',
        })
    },
    getProductionUsePack: (params: { varietyInitial?: string,productType?: string }) => {
        return request<{ data: ProductionUsePackRes[] }>({
            params,
            url: '/ypProductionManagement/findProductionUsePack',
            method: 'get',
        })
    },
    setAdjustPracticalYield: (data: any) => {
        return request({
            data,
            url: '/ypPackagingManagement/adjustPracticalYield',
            method: 'post',
        })
    },
    downloadOutsourcingInfo: (varietyName: string, callback: any) => {
        return request({
            params: { varietyName },
            url: `/ypPackagingManagement/exportOutsourcingInfo`,
            method: 'get',
            responseType: 'blob'
        }, callback)
    },
    sendPrint: (data: any) => {
        return request({
            data,
            url: '/ypPackagingManagement/printSend',
            method: 'post',
        })
    },
    addInput:(data:{id:string,putIntoNum:number})=>{
        return request({
            data,
            url: '/ypPackagingManagement/adjustInventory',
            method: 'post',
        })
    },
    getAddInputDetail:(params:{packagingId:string})=>{
        return request({
            params,
            url: '/ypPackagingManagement/findInventoryRecord',
            method: 'get',
        })
    },
    // ------------------------ 外包管理 ----------------
    getRecord:(params:{id:string})=>{
        return request({
            params,
            url: '/ypPackagingManagement/findPackaging',
            method: 'get',
        })
    },
    // ------------------------ 审核分包 ----------------
    getAuditSubList: (params: { varietyName?: string; subpackageState?: string } & ListDefParams) => {
        return request<{ data: ListRowRes<AuditSubListRes> }>({
            params,
            url: '/ypPackagingManagement/findSubpackage',
            method: 'get',
        })
    },
    getAuditSubDetail: (params: { id: string; }) => {
        return request<{ data: AuditSubListRes }>({
            params,
            url: '/ypPackagingManagement/findSubpackage',
            method: 'get',
        })
    },
    setAuditDetail: (data: any) => {
        return request({
            data,
            url: '/ypPackagingManagement/subpackageOperation',
            method: 'post',
        })
    },
    // ------------------------ 打印管理 ----------------
    getPrintInfoList: (params: { varietyName?: string } & ListDefParams) => {
        return request<{ data: ListRowRes<PrintInfoListRes> }>({
            params,
            url: '/ypPackagingManagement/findPrintInfo',
            method: 'get',
        })
    },
    getPrintInfoDetail: (params: { id: string }) => {
        return request<{ data: PrintInfoListRes }>({
            params,
            url: '/ypPackagingManagement/findPrintInfo',
            method: 'get',
        })
    },
    getSendDetail: (params: { id: string }) => {
        return request<{ data: PrintSendDetialRes }>({
            params,
            url: '/ypPackagingManagement/findSendInfo',
            method: 'get',
        })
    },
    downloadPrintList: (varietyName: string, callback: any) => {
        return request({
            params: { varietyName },
            url: `/ypPackagingManagement/exportPrintInfo`,
            method: 'get',
            responseType: 'blob'
        }, callback)
    },
    downloadPrintOne: (params: any, callback: any) => {
        return request({
            params,
            url: `/ypPackagingManagement/downloadPrintQrCode`,
            method: 'get',
            responseType: 'blob'
        }, callback)
    },
    addPrintNum: (data: any) => {
        return request({
            data,
            url: '/ypPackagingManagement/addPrintNum',
            method: 'post',
        })
    },
    // ------------------------ 成品入库 ----------------
    getInboundList: (params: { name?: string; type: string } & ListDefParams) => {
        return request<{ data: ListRowRes<ProductInListRes> }>({
            params,
            url: '/ypPackagingManagement/findProductionAndPackInfo',
            method: 'get',
        })
    },
    getInboundDetail: (params: { id: string;type?:string }) => {
        return request<{ data: ProductInListRes }>({
            params,
            url: '/ypPackagingManagement/findProductionAndPackInfo',
            method: 'get',
        })
    },


    // ------------------------ 药材产业信息 ----------------
    getMedHerbList: (params: any) => {
        return request({
            params,
            url: '/ypRetrospectSourceTemplate/findSourceTemplate',
            method: 'get',
        })
    },
    changeMedHerbState: (data: { id: number, templateState: number }) => {
        return request({
            data,
            url: '/ypRetrospectSourceTemplate/updateState',
            method: 'post',
        })
    },
    editOrAddMedHerb: (data: any) => {
        return request({
            data,
            url: '/ypRetrospectSourceTemplate/addRetrospectSourceTemplate',
            method: 'post',
        })
    },
    removeData:(id:string)=>{
        return request({
            url: '/ypRetrospectSourceTemplate/removeSourceTemplate/'+id,
            method: 'delete',
        })
    },
    getTemplate:(params:any,callback?)=>{
        return request({
            params,
            url: '/ypRetrospectSourceTemplate/findSourceTemplateByCondition',
            method: 'get',
        },callback)
    },
    exportRecords:(callback:any)=>{
        return request({
            url: '/ypRetrospectSourceTemplate/exportTemplateData',
            method: 'get',
            responseType: 'blob'
        },callback)
    },
    // ------------------------ 原料入库 ----------------
    getRawInboundList: (params: { varietyName?: string; rawType: string; enterStorageType?: string } & ListDefParams) => {
        return request<{ data: ListRowRes<EnterLibraryListRes> }>({
            params,
            url: '/ypInventory/findEnterLibraryInfo',
            method: 'get',
        })
    },
    getRawInboundDetail: (params: { id: string }) => {
        return request<{ data: EnterLibraryListRes }>({
            params,
            url: '/ypInventory/findEnterLibraryInfo',
            method: 'get',
        })
    },
    addRawInfo: (data: any) => {
        return request({
            data,
            url: '/ypInventory/addNotRetrospectSource',
            method: 'post',
        })
    },
    editRawState: (data: any) => {
        return request({
            data,
            url: '/ypInventory/executeOperation',
            method: 'post',
        })
    },
    auditState: (data: any) => {
        return request({
            data,
            url: '/ypInventory/executeOperation',
            method: 'post',
        })
    },
    deleteInboundInfo:(id:string)=>{
        return request({
            url: '/ypInventory/removeEnterLibraryInfoById/'+id,
            method: 'delete',
        })
    },
    getQrCode:(params:any,callback:any)=>{
        return request({
            params,
            url: '/ypInventory/generateQrCode',
            method: 'get',
            responseType: 'blob'
        }, callback)
    },
    updatePutInNum:(data:{id:string,enterStorageNum:any,unit:string})=>{
        return request({
            data,
            url: '/ypInventory/adjustEnterStorageNum',
            method: 'post',
        })
    },
    // ------------------------ 库存管理 ----------------
    getInventoryList: (params: any) => {
        return request({
            params,
            url: '/ypInventory/findInventory',
            method: 'get',
        })
    },
    exportInventoryData:(params:{type:string},callback:any)=>{
        return request({
            params,
            url: '/ypInventory/exportInventoryData',
            method: 'get',
            responseType: 'blob'
        }, callback)
    },
    // ------------------------ 图片上传 ----------------
    uploadImage: (data: any) => {
        return request({
            data,
            url: '/file/uploadImage',
            method: 'post',
        })
    },

    getVarietyName: (params: any) => {
        return request({
            params,
            url: '/bizSourceinfo/findInfoByVarietyName',
            method: 'get',
        })
    },
    changePassword: (data: any) => {
        return request({
            data,
            url: '/ypAccount/changePassword',
            method: 'post',
        })
    },
    // ------------------------ 产品大类装量管理 ----------------
    getProductVolumeList: (params: {id?:string,productBigKind?:string,discretion?:string,productType?:string,medicineClass?:string}) => {
        return request({
            params,
            url: '/ypProductKindDiscretion/findProductKindDiscretion',
            method: 'get',
        })
    },
    addProductVolume: (data: {id:string,productBigKind:string,discretion:string,}) => {
        return request({
            data,
            url: '/ypProductKindDiscretion/addProductKindDiscretion',
            method: 'post',
        })
    },
    delProductVolume:(id:string)=>{
        return request({
            url:`/ypProductKindDiscretion/removeProductKindDiscretion/${id}`,
            method:'get'
        })
    }
}
export default nextApi
